package com.netflexitysolutions.amazonws.ec2;

import java.util.HashMap;
import java.util.Map;

public enum IPProtocol {
	
	TCP("tcp"), UDP("udp"), ICMP("icmp");
	
	private static Map<String, IPProtocol> protocolByName = new HashMap<String, IPProtocol>();
	
	static {
		IPProtocol[] protocols = IPProtocol.values();
		for (IPProtocol protocol : protocols) {
			protocolByName.put(protocol.getName(), protocol);
		}
	}
	
	public static IPProtocol ipProtocolForName(String name) {
		return protocolByName.get(name);
	}

	private String name;
	
	private IPProtocol(String name) {
		this.name = name;
	}
	
	public String getName() {
		return name;
	}
}
